package com.study.service.impl;

import com.study.entity.UserInfo;
import com.study.repository.UserInfoRepository;
import com.study.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserInfoRepository userInfoRepository;

    @Override
    public UserInfo findById(String id) {
        return userInfoRepository.findById(id).get();
    }

    @Override
    @Transactional
    public UserInfo updateInfo(UserInfo userInfo) {
        UserInfo result = userInfoRepository.save(userInfo);
        return result;
    }
}
